package com.csnf.service;

import com.csnf.dao.TaskDao;
import com.csnf.entity.Task;
import com.csnf.util.MybaitsUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class TaskService {
    private  TaskDao taskDao;

    public  List<Task> getTask(Task task){
        SqlSession session = MybaitsUtil.init();
        taskDao = session.getMapper(TaskDao.class);
        List<Task> list = taskDao.getTask(task);
        return list;
    }
    public int addTask(Task task){
        SqlSession session = MybaitsUtil.init();
        taskDao = session.getMapper(TaskDao.class);
        int rows = taskDao.addTask(task);
        MybaitsUtil.close();
        return rows;
    }
}
